<?Lassoscript
// Last modified 12/19/11 by ECL, Landmann InterActive

// FUNCTIONALITY
// This file builds the Javascript for a SudoSlider

// CHANGE NOTES
// 12/19/11
// First implementation

// Get Slider config records and build the form fields
Var('SQLGetFormFields' = ('SELECT ST.Slider_Type, SliderConfigName, SliderConfigValue FROM cms_slidertype AS ST
LEFT JOIN cms_sliderconfig AS SC
ON (ST.Slider_SliderTypeID=SC.Slider_SliderTypeID)
WHERE ST.Slider_SliderTypeID='+($vSlider_SliderTypeID)+'
AND SC.SG_GroupID='+($vSliderGroupID)+'
ORDER BY ID'));
Inline(-Database=$svSiteDatabase, -Table='cms_sliderconfig', -SQL=$SQLGetFormFields);
	$SliderJS += ('<!-- vSlider_SliderTypeID = '+($vSlider_SliderTypeID)+' -->\n');
	$SliderJS += ('<!-- vSliderGroupID = '+($vSliderGroupID)+' -->\n');
	$SliderJS += ('<!-- SQLGetFormFields = '+($SQLGetFormFields)+' -->\n');
	$SliderJS += '<!-- START build_sliderJS_sudo -->\n';
	$SliderJS += '<script type="text/javascript">
	$(document).ready(function(){\n';
	// Images
	$SliderJS += '\tvar ajaximages = [\n';
	$SliderJS += $ajaxImages;
	$SliderJS += '\t];\n';
	// Captions
	$SliderJS += '\tvar imagestext = [\n';
	$SliderJS += $imagestext;
	$SliderJS += '\t];\n';
	// Controls
	$SliderJS += ('\tvar sudoSlider = $("#slider").sudoSlider({ \n');

	If(Found_Count > 0);
		Records;
			$SliderJS += ('\t\t'+(Field('SliderConfigName'))+':'+(Field('SliderConfigValue'))+',\n');
		/Records;
	/If;

	$SliderJS += ('\t\tajax: ajaximages,
	ajaxLoadFunction: function(t){
		$(this)
		.css("position","relative")
		.append(\'<div class="caption" >\' + imagestext[t-1] + \'</div>\');
		},
	beforeAniFunc: function(t){ 
		$(this).children(\'.caption\').hide();	
		},
	afterAniFunc: function(t){ 
		$(this).children(\'.caption\').slideDown(400);
		}
		});
	});
</script>\n');

/Inline;


$SliderJS += '<!-- END build_sliderJS_Sudo -->\n';
